package com.bbz.crawler.ip.proxy.pool.jobhandler;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.bbz.crawler.ip.proxy.pool.core.processor.IpProxyPoolProcessor;
import com.bbz.crawler.ip.proxy.pool.core.validation.ProxyIpValidation;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler;
import com.xxl.job.core.log.XxlJobLogger;

/**
 * 爬取Ip任务Handler（Bean模式）
 * 
 * @author binbin.a.zhang 2018-05-30
 */
@JobHandler(value = "proxyIpValidationHandler")
@Component
@Transactional
public class ProxyIpValidationHandler extends IJobHandler {
	@Autowired
	ProxyIpValidation proxyIpValidation;

	@Override
	public ReturnT<String> execute(String param) throws Exception {
		XxlJobLogger.log("ProxyIpValidationHandler-JOB, Start.Param" + param);
		proxyIpValidation.run(Integer.parseInt(param));
		XxlJobLogger.log("ProxyIpValidationHandler-JOB, End.");
		return SUCCESS;
	}

}